
//
// Ancestral states with PP less than this value will not be printed.
// When used with "%.3f", a PP value of 0.0005 will round to 0.001.
#define UNLIKELY_ANC_STATE 0.0005

#ifdef ENABLE_ASR
void Do_Asr(t_tree *tree);
void Make_Asr_Data(t_tree *tree);
void Free_Asr_Data(t_tree *tree);

void Joint_Asr(t_node *a, t_node *d, t_tree *tree);
void Joint_Recur_Up(t_node *a, t_node *d, t_tree *tree);
void Joint_Recur_Up_Terminal(t_node *x, t_tree *tree);
void Joint_Recur_Up_Internal(t_node *a, t_node *x, t_tree *tree);

void Joint_Recur_Down(t_node *a, t_node *x, t_tree *tree);
void Joint_Recur_Down_Internal(t_node *a, t_node *x, t_tree *tree);

void Build_Asr_Filename(t_node *d, t_tree *tree, char *out_asr_filepath);
void Marginal_Asr_Node(t_node *a, t_node *d, t_tree *tree, int site, phydbl *state_pp, int *ranked_states);
void Marginal_Asr(t_node *a, t_node *d, t_tree *tree);
//void Quicksort( phydbl pps[], int states[], int left, int right);

int Partition(int low,int high,phydbl pps[],int states[]);
void Quick_sort(int low, int high, phydbl pps[], int states[]);

#endif
